import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class HomeState {
  final List<Tab> tabs = const [
    Tab(text: '全部'),
    Tab(text: '待审核'),
    Tab(text: '采纳'),
    Tab(text: '毙稿'),
    Tab(text: '无操作'),
    Tab(text: '无操作'),
    Tab(text: '无操作'),
    Tab(text: '无操作'),
  ];

  /// 当前展示的tab
  var currentIdx = 0;

  /// tab下的列表数据
  var dataSource = <int, List<dynamic>>{};

  /// 页码信息
  var pageData = <int>[];

  /// tab的刷新控制器
  List<RefreshController> refreshs = [];
  HomeState() {
    refreshs = tabs.map((e) => RefreshController()).toList();
    pageData = List.generate(tabs.length, (index) => 1);
  }

  /// 更新当前展示的tab页码信息
  void updatePage(int value) {
    pageData[currentIdx] = value;
  }
}
